<?php 
class MstLookup extends base_model 
{
	const tablename = 'mstlookup';
	var	$lkpid;
	var	$namespace;
	var	$lkpkey;
	var	$lkpval;

	var $arr;
		
	public function __construct($nmspc='')
	{					
		if($nmspc!='')
			$this->Inquiry($nmspc);
	}

	function Update()
	{

		
		//$this->UpdateBy=$this->loginuser['uname'];
		//$this->UpdateDate=date('Y-m-d H:i:s');		
		//$this->db->where('KdBrg', $this->roleid);
		//return $this->db->update($this->db->dbprefix($this::tablename), $this); 
	}
	
	function Create($id)
	{	
		//$this->CreatedBy=$this->loginuser['uname'];
		//$this->Created=date('Y-m-d H:i:s');
		//return $this->db->insert($this->db->dbprefix($this::tablename), $this); 
	}

	function LookUp($roleid)
	{	
		//$rw= $this->Inquiry($roleid);	
		
		//if(count($rw)>0){				
		//		$this->KdBrg =$rw['KdBrg'];
		//		$this->NmBrg =$rw['NmBrg'];
		//		$this->BCode =$rw['BCode'];
		//		$this->TypeBrg=$rw['TypeBrg'];
		//		$this->UnitId=$rw['UnitId'];
		//		$this->MinStock=$rw['MinStock'];
		//		$this->InitStock=$rw['InitStock'];		
		//}
		//else{
		//	return false;
		//}
	}

	function Delete($id)
	{
		//$this->db->where_in('KdBrg', $id);
		//return $this->db->delete($this->db->dbprefix($this::tablename)); 		
	}	

	public function Inquiry($nmspc = false,$order=false,$key=false,$val=false)
	{	
		
		if($nmspc)
		 $this->db->where('namespace',$nmspc);		
		
		 if($key)
		 $this->db->where('lkpkey',$key);	

		 if($val)
		 $this->db->where('lkpval',$val);	

		if($order)
		$this->db->order_by($order);

		$query = $this->db->get($this->db->dbprefix($this::tablename));				
					
		//if ($nmspc === false)
		//{
		//	$this->arr=$query->result_array();														
			
		//	return $this->arr;
		//}
				
		
			$this->arr=$query->result_array();
			return $this->arr;
		
	} 




}



?>



